To write a sound output device component, you might need to define routines that manage the flow of data in a sound channel:
A sound output device component must implement the SoundComponentStartSource function. The Sound Manager calls this function to start playing sounds in one or more sound channels.
pascal ComponentResult SoundComponentStartSource
(ComponentInstance ti,
short count, SoundSource
*sources);
Your SoundComponentStartSource function is called by the Sound Manager to begin playing the sounds originating from the sound sources specified by the sources parameter. Your function should start (or resume) sending data from those sources to the associated sound output device. If your component supports only one sound source, you can ignore the sources parameter.
A sound output device component must implement the SoundComponentStopSource function. The Sound Manager calls this function to stop playing sounds in one or more sound channels.
pascal ComponentResult SoundComponentStopSource
(ComponentInstance ti, short
count,
SoundSource *sources);
Your SoundComponentStopSource function is called by the Sound Manager to stop the sounds originating from the sound sources specified by the sources parameter. Your function should stop sending data from those sources to the associated sound output device. In addition, your SoundComponentStopSource function should flush any data from the specified sound sources that it's caching. If your component supports only one sound source, you can ignore the sources parameter.
A sound output device component must implement the SoundComponentPauseSource function. The Sound Manager calls this function to stop pause the playing of sounds in one or more sound channels.
pascal ComponentResult SoundComponentPauseSource
(ComponentInstance ti,
short count, SoundSource
*sources);
Your SoundComponentPauseSource function is called by the Sound Manager to pause the playing of the sounds originating from the sound sources specified by the sources parameter. Your function should stop sending data from those sources to the associated sound output device. Because your SoundComponentStartSource function might be called to resume playing sounds, you should not flush any data. If your component supports only one sound source, you can ignore the sources parameter.
A sound component must implement the SoundComponentPlaySourceBuffer function. The Sound Manager calls this function to start a new sound playing.
pascal ComponentResult SoundComponentPlaySourceBuffer
(ComponentInstance ti,
SoundSource sourceID,
SoundParamBlockPtr pb,
long actions);
Your SoundComponentPlaySourceBuffer function is called by the Sound Manager to start a new sound playing. The sound parameter block pointed to by the pb parameter specifies the sound to be played. That parameter block should be passed successively to all sound components in the chain specified by the sourceID parameter. This allows the components to determine their output formats and playback settings and to prepare for a subsequent call to their SoundComponentGetSourceData function. It also allows a sound output device component to prepare for starting up its associated hardware.
| Previous | Chapter contents | Chapter top | Section top |